Mic-1 MMV Simulator (V. 2.0)
Examples
This section presents basic examples to help you get started quickly with
the Mic-1 MMV simulator.
Example 1: Loading and Running an IJVM Program
This example shows you how to load an IJVM program and run it without
interruption.
1. Launch the simulator, as described in Installation Step 3.
2. Choose File > Load IJVM program from the Mic-1 MMV menu bar.
3. In the File chooser, navigate to the examples/JAS-IJVM Examples subdirectory. If you have launched from the bin directory, this directory is found by moving up one level, then down through the examples directory.
4. Select ijvmtest.ijvm. The IJVM program should appear in the Method Area.
5. Select Prog Speed on the Command Console (i.e. the radio button
labeled Prog).
6. Click the Run button (the one with the blue right arrow) on the Command Console to begin interpretation of the IJVM program by the default microprogram. After a brief period, while the simulator is
running, you should see the following in the "Output Console" text
area:
OK
Example 2: Assembling a JAS Program
This example shows you how to edit, and assemble a JAS source program,
and load the resulting IJVM object program.
1. Find the following file: examples/JAS-IJVM Examples/ijvmtest.jas
2. Open this file in your favorite text editor (emacs, Notepad, etc.)
3. Go to line 451.
4. Replace the lines:
OK: BIPUSH 79
OUT
BIPUSH 75
OUT
HALT
with
OK: BIPUSH 65
OUT
BIPUSH 79
OUT
BIPUSH 75
OUT
HALT
5. Save the changes.
6. Choose File > Assemble/Load IJVM program from the
Mic-1 MMV menu bar.
7. Navigate to examples/JAS-IJVM, and select
the following file:
ijvmtest.jas
8. The "Assembling ijvmtest.jas ..." window should appear, with assembly complete appearing soon in the text area. Click the Load button.
9. Select Prog Speed and click Run. The Output Console should
now display:
AOK
Example 3: Re-Assembling a JAS Program
Once a JAS file has been assembled and loaded, it can be re-assembled
and loaded using the Mic-1 Menu bar command Assemble/Load > Current JAS Assemble/Load. No further file selection is required.
This example also shows what happens when there is an error in a JAS program.
1. After completing Example 1, re-edit ijvmtest.jas, remove the colon
after OK, and save the changes:
OK BIPUSH 65
OUT
BIPUSH 79
OUT
BIPUSH 75
OUT
HALT
2. Choose Assemble/Load > Current JAS Assemble/Load from the
Mic-1 MMV menu bar.
The "Assembling ijvmtest.jas" window should appear with the
following error message:
IJVM Assembler...
1433: Invalid instruction: ok
1424: Invalid goto label: ok
3. Close the window and re-edit the file. Restore the colon, and
remove the lines
BIPUSH 65
OUT
so the program looks like it did originally.
4. Try Step 2 again. This time, no error message will be displayed. Load the program, click the Reset button, and run it again. The result in the Output Console should be OK, just like the first time.
Example 4: Trying different speeds
This example shows how the simulator operates at different
"speeds". Here, "speed" means the amount of computation that takes
place when the Run button is clicked once. You will also see how to
use the Delay Mode to demonstrate the simulator's action.
1. Launch the simulator, and choose File > Assemble/Load IJVM program from the menu bar.
2. Select the file: examples/JAS-IJVM/add.jas.
3. Load the program when it finishes assembling.
4.Try the program first at Prog Speed. This program adds 2 hexadecimal numbers. Run it, and type the following into the Input Console:
1234
5678
Note the echoing in the Output Console. When you are done, the Output Console should contain
| 1234 |
| + | 5678 |
| ======== |
| 000068AC |
You can enter another pair of numbers to sum in the Input
Console. (Be sure to use capitals A ... F for the high-end hex
digits.) Click "Stop" (the stop sign) when you are done.
5. Now, click Reset, and change the speed to IJVM Speed.
6. Click the Run button several times, and note the highlighting of
IJVM instructions in the Method Area. Each click executes a single
IJVM instruction. You can also click the Reverse button (the
left-pointing red arrow) to back up a step.
7. Now, click the Delay On button, and click Reset and the
Run button as in the previous step. Note that the sequence of
microcode instructions used to interpret the current IJVM
instruction is shown, and the data path is illustrated in the
Architecture View. (The leftmost window shows registers
and busses).
8. Select Delay Off and Clock Speed. Then, Reset and Run
several steps. Each step shows the execution of one
microinstruction. The Reverse button backs up one
microinstruction.
9. On the Menu Bar, choose Microstore >View Microstore.
The Microstore Window will appear, and you can follow the
execution of the microprogram while clicking Run. Try it with
Delay on to see the subcycles illustrated as before.
10. Finally, select Delay Off and SubClock Speed, then
Reset and Run several steps. Each step is now a quarter cycle.
Reverse works as you'd expect, but Delay On has no effect
at this speed.
Please continue to the next step: Using the Help System
|